package com.lanou3g.sockerPractice;

import com.lanou3g.practice.*;

import java.io.*;
import java.net.Socket;

/**
 * Created by dllo on 18/4/21.
 */
public class ClentReadThread extends Thread{

    private Socket socket;

    public ClentReadThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {

        BufferedReader br = null;

        try {
            InputStream is = socket.getInputStream();

            br = new BufferedReader(new InputStreamReader(is));

            String line = "";
            while ((line = br.readLine()) != null){
                System.out.println(line);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
           IOUtils.closeAll(br);
        }





    }
}
